package com.example.config;

import com.example.entity.po.MemberPO;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.List;

public class SecurityMemberPO extends User {
    private MemberPO originalMemberPO;

    public  SecurityMemberPO(MemberPO admin, List<GrantedAuthority> authorities) {
        super(admin.getUserName(), admin.getUserPswd(), authorities);

        this.originalMemberPO = admin;
        // 为了保证安全性，擦除放入originalAdmin的对象的密码
        this.originalMemberPO.setUserPswd(null);
    }

    public MemberPO getOriginalAdmin() {
        return this.originalMemberPO;
    }
}

